package com.example.bausip;

public class Instructor {
	private int id, uniId, officeId;
	private String fName;
	private String lName;
	private String password;
	private String position;

	public Instructor(int id, int uniId, int officeId, String fname, String lname,String password) {
		this.setId(id);
		this.setUniId(uniId);
		this.setOfficeId(officeId);
		this.setFName(fname);
		this.setLName(lname);
		this.setPassword(password);
	}

	public Instructor(int id, String fname, String lname) {
		this.setId(id);
		this.setFName(fname);
		this.setLName(lname);
	}

	public Instructor(int uniId, String password) {
		this.setPassword(password);
		this.setUniId(uniId);
	}

	public Instructor(int id) {
		this.setId(id);
	}

	public String getFName() {
		return this.fName;
	}

	public void setFName(String fname) {
		this.fName = fname;
	}

	public String getLName() {
		return this.fName;
	}

	public void setLName(String lname) {
		this.lName = lname;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void setEncPassword(String password) {
		this.password = // Hashing.sha256().hashString(
		password
		// , Charsets.UTF_8).toString()
		;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String toString() {
		return this.fName + " " +  this.lName;
	}

	public ValidationError validate(boolean mine) {
		boolean valid = false;
		int msg = 0;
		if (this.fName.isEmpty() || this.fName.length() < 3) {
			msg = R.string.invalid_name;
		} else
			valid = true;
		return new ValidationError(valid, msg);
	}

	@Override
	public boolean equals(Object obj) {
		Instructor u = (Instructor) obj;
		if (this.id == u.getId())
			return true;
		return false;
	}

	public int getUniId() {
		return uniId;
	}

	public void setUniId(int uniId) {
		this.uniId = uniId;
	}

	public int getOfficeId() {
		return officeId;
	}

	public void setOfficeId(int officeId) {
		this.officeId = officeId;
	}

	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}
}
